package avicit.bdp.dcs.job.dao;

import avicit.bdp.common.base.BaseDAO;
import avicit.bdp.common.dto.ProcessInstanceDto;
import avicit.bdp.common.dto.TaskInstanceDto;
import avicit.bdp.dcs.job.dto.JobDTO;
import avicit.bdp.dcs.log.dto.ProcessDefinitionDto;
import avicit.bdp.dcs.task.dto.TaskDTO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-08-04 11:32
 * @类说明：
 * @修改记录：
 */
@Repository
public interface DcsJobDao extends BaseDAO<JobDTO> {

    Page<JobDTO> getJobList(@Param("jobStatus") Integer jobStatus, @Param("name") String name,
                            @Param("jobType") Integer jobType, @Param("orderField") String orderField,
                            @Param("orderType") String orderType, @Param("createdBy") String createdBy,
                            @Param("projectId") String projectId, @Param("wordSecretList") List<String> wordSecretList);

    ProcessInstanceDto getProcessInstanceByProcessDefinitionId(@Param("processDefinitionId") String processDefinitionId);

    List<ProcessInstanceDto> getProcessInstanceListByProcessDefinitionId(@Param("jobList") List<JobDTO> jobList);

    ProcessInstanceDto getProcessInstanceById(@Param("processInstanceId") String processInstanceId);

    void updateProcessDefinitionExtraParams(@Param("processDefinitionId") String processDefinitionId,
                                            @Param("extraParams") String extraParams);

    ProcessDefinitionDto getProcessDefinitionByProcessDefinitionId(@Param("processDefinitionId") String processDefinitionId);

    TaskInstanceDto getTaskInstanceById(@Param("taskInstanceId") String taskInstanceId);

    TaskInstanceDto getTaskInstanceByProcessInstanceId(@Param("processInstanceId") String processInstanceId, @Param("name") String name);

    int countProcessInstanceByProcessDefinitionId(@Param("processDefinitionId") String processDefinitionId);

    TaskDTO selectByJobIdAndSrcTableName(@Param("jobId") String jobId, @Param("srcTableName") String srcTableName);

    List<TaskInstanceDto> getTaskInstanceListByProcessInstanceId(@Param("processInstanceList") List<String> processInstanceList);

    List<TaskInstanceDto> getSparkTaskInstanceListByProcessInstanceId(@Param("processInstanceId") String processInstanceId);

}
